﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.ZY
{
    class Class13
    {
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            int age = ppa.Age;

            if (age == 15 || age == 16 || age == 17)
            {
                da.Value = ppa.Amount;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                da.Value = ppa.Amount * 0.1;
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            IPolicyPeriodActing dppa = ppa.PolicyActing.PeriodActings.FirstOrDefault(p => p.SchemePeriodActing.HolderStates.Contains("身故"));

            if (dppa!=null && ppa.Period >= dppa.Period)
            {
                da.Value = ppa.Amount;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            if (ppa.SchemePeriodActing.HolderAge < 60)
            {

                IPolicyPeriodActing dppa = ppa.PolicyActing.PeriodActings.FirstOrDefault(p => p.SchemePeriodActing.HolderStates.Contains("全残"));

                if (dppa != null && ppa.Period >= dppa.Period)
                {
                    da.Value = ppa.Amount;
                    ppa.Fee = 0;
                }
            }

        }
    }
}
